// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const { ccclass, property } = cc._decorator;

@ccclass
export default class ObjectMove extends cc.Component {

    @property
    speed: number = 2;

    start() {

    }
    update() {
        let list = this.node.children;
        for (let index = 0; index < list.length; index++) {
            const element = list[index];
            element.x += this.speed;
            if (element.x > this.node.width) {
                element.x = 0 - element.width - 50;
            }
        }
    }
    // update (dt) {}
}
